define(function(require, exports, module) {
	"use strict";
	require("../../dep/mui/js/mui.min.js");
	require("../jquery-3.1.1.min.js");
	require("common");
	var abpUse = require("../abp.js");
	var abp = abpUse.abpstart;
	var template = require("template");
	//调用日期筛选传值
	require("getSearchDateItem");
	//调用状态筛选值
	require("recordStatusID");
	//引入关闭tabjs
	var chioceTab = require("chioceTab");

	mui.init({
		swipeBack: true //启用右滑关闭功能
	});

	var optionSource = {};
	InitAllocate("", "", 0, 0, "allocateList", "#allocate-item");

	function InitAllocate(start, end, outWhId, inWhId, templateId, mainId) {
		var CompanyId = [];
		var StatusId = [];
		var Serial = '';

		var option = {};
		var dataModel = {
			"Serial": Serial, //单号
			"CompanyId": CompanyId, //供应商
			"BusUserId": 0, //业务员
			"StatusId": StatusId, //状态
			"Start": start, //开始日期
			"End": end, //结束日期
			"OutWhId": outWhId, //调出仓
			"InWhId": inWhId, //调入仓
			"pageIndex": 1,
			"pageSize": 100
		};
		abp.services.app.whAllocateList.getPage(dataModel, option)
			.done(function(data) {
				var items = data.items;
				$.each(items, function(i, v) {
					var serialDate = v.serialDate.substring(0, 10);
					var dataCreated = v.dataCreated.substring(0, 10);
					v.dataCreated = dataCreated;
					v.serialDate = serialDate;
				});
				var html = template(templateId, data);
				$(mainId).html(html);
			})
			.fail(function(data) {

			});
	}
	//按时间筛选数据
	mui('body').on('tap', '.pop-tab-con1 li', function() {
		var start = $(this).attr('data-startDate');
		var end = $(this).attr('data-endDate');
		var outWhId = 0;
		var inWhId = 0;
		InitAllocate(start, end, outWhId, inWhId, "allocateList", "#allocate-item");
	});
	//引入tab关闭
	mui("body").on("tap", ".pop-tab-conitem li", function() {
		chioceTab.muiSure();
	});

});